from sqlalchemy import Column, Integer, String, Text, SmallInteger
from sqlalchemy.dialects.mysql import INTEGER, TINYINT
from mooc.db.database import Base


# Users模型用于映射数据库表ims_users
class Users(Base):
    __tablename__ = "ims_users"

    acid = Column(INTEGER(unsigned=True), primary_key=True)  # 将uid改为acid
    owner_uid = Column(Integer, nullable=False)
    groupid = Column(INTEGER(unsigned=True), nullable=False)
    founder_groupid = Column(TINYINT, nullable=False)
    username = Column(String(30), nullable=False)
    password = Column(String(200), nullable=False)
    salt = Column(String(10), nullable=False)
    type = Column(TINYINT, nullable=False)
    status = Column(TINYINT, nullable=False)
    joindate = Column(INTEGER(unsigned=True), nullable=False)
    joinip = Column(String(15), nullable=False)
    lastvisit = Column(INTEGER(unsigned=True), nullable=False)
    lastip = Column(String(15), nullable=False)
    remark = Column(String(500), nullable=False)
    starttime = Column(INTEGER(unsigned=True), nullable=False)
    endtime = Column(INTEGER(unsigned=True), nullable=False)
    register_type = Column(TINYINT, nullable=False)
    openid = Column(String(50), nullable=False)
    welcome_link = Column(TINYINT, nullable=False)
    notice_setting = Column(String(5000), nullable=False)
    is_bind = Column(TINYINT, nullable=False)

    class Config:
         from_attributes = True

# UsersBind模型用于映射数据库表ims_users_bind
class UsersBind(Base):
    __tablename__ = "ims_users_bind"

    acid = Column(Integer, primary_key=True)  # 将id改为acid
    uid = Column(Integer, nullable=False)
    bind_sign = Column(String(50), nullable=False)
    third_type = Column(TINYINT, nullable=False)
    third_nickname = Column(String(255), nullable=False)

    class Config:
         from_attributes = True

# UsersCreateGroup模型用于映射数据库表ims_users_create_group
class UsersCreateGroup(Base):
    __tablename__ = "ims_users_create_group"

    acid = Column(Integer, primary_key=True)  # 将id改为acid
    group_name = Column(String(50), nullable=False)
    maxaccount = Column(Integer, nullable=False)
    maxwxapp = Column(Integer, nullable=False)
    maxwebapp = Column(Integer, nullable=False)
    maxphoneapp = Column(Integer, nullable=False)
    maxxzapp = Column(Integer, nullable=False)
    maxaliapp = Column(Integer, nullable=False)
    createtime = Column(Integer, nullable=False)
    maxbaiduapp = Column(Integer, nullable=False)
    maxtoutiaoapp = Column(Integer, nullable=False)

    class Config:
         from_attributes = True

# UsersExtraGroup模型用于映射数据库表ims_users_extra_group
class UsersExtraGroup(Base):
    __tablename__ = "ims_users_extra_group"

    acid = Column(Integer, primary_key=True)  # 将id改为acid
    uid = Column(Integer, nullable=False)
    uni_group_id = Column(Integer, nullable=False)
    create_group_id = Column(Integer, nullable=False)

    class Config:
         from_attributes = True


# UsersExtraLimit模型用于映射数据库表ims_users_extra_limit
class UsersExtraLimit(Base):
    __tablename__ = "ims_users_extra_limit"

    acid = Column(Integer, primary_key=True)  # 将id改为acid
    uid = Column(Integer, nullable=False)
    maxaccount = Column(Integer, nullable=False)
    maxwxapp = Column(Integer, nullable=False)
    maxwebapp = Column(Integer, nullable=False)
    maxphoneapp = Column(Integer, nullable=False)
    maxxzapp = Column(Integer, nullable=False)
    maxaliapp = Column(Integer, nullable=False)
    timelimit = Column(Integer, nullable=False)
    maxbaiduapp = Column(Integer, nullable=False)
    maxtoutiaoapp = Column(Integer, nullable=False)

    class Config:
         from_attributes = True

# UsersExtraModules模型用于映射数据库表ims_users_extra_modules
class UsersExtraModules(Base):
    __tablename__ = "ims_users_extra_modules"

    acid = Column(Integer, primary_key=True)  # 将id改为acid
    uid = Column(Integer, nullable=False)
    module_name = Column(String(100), nullable=False)
    support = Column(String(50), nullable=False)

    class Config:
         from_attributes = True

# UsersExtraTemplates模型用于映射数据库表ims_users_extra_templates
class UsersExtraTemplates(Base):
    __tablename__ = "ims_users_extra_templates"

    acid = Column(Integer, primary_key=True)  # 将id改为acid
    uid = Column(Integer, nullable=False)
    template_id = Column(Integer, nullable=False)

    class Config:
         from_attributes = True

# UsersFailedLogin模型用于映射数据库表ims_users_failed_login
class UsersFailedLogin(Base):
    __tablename__ = "ims_users_failed_login"

    acid = Column(INTEGER(unsigned=True), primary_key=True)  # 将id改为acid
    ip = Column(String(15), nullable=False)
    username = Column(String(32), nullable=False)
    count = Column(TINYINT, nullable=False)
    lastupdate = Column(INTEGER(unsigned=True), nullable=False)

    class Config:
         from_attributes = True




# UsersFounderGroup模型用于映射数据库表ims_users_founder_group
class UsersFounderGroup(Base):
    __tablename__ = "ims_users_founder_group"

    acid = Column(INTEGER(unsigned=True), primary_key=True)  # 将id改为acid
    name = Column(String(50), nullable=False)
    package = Column(String(5000), nullable=False)
    maxaccount = Column(INTEGER(unsigned=True), nullable=False)
    timelimit = Column(INTEGER(unsigned=True), nullable=False)
    maxwxapp = Column(INTEGER(unsigned=True), nullable=False)
    maxwebapp = Column(Integer, nullable=False)
    maxphoneapp = Column(Integer, nullable=False)
    maxxzapp = Column(Integer, nullable=False)
    maxaliapp = Column(Integer, nullable=False)
    maxbaiduapp = Column(Integer, nullable=False)
    maxtoutiaoapp = Column(Integer, nullable=False)

    class Config:
         from_attributes = True

# UsersFounderOwnCreateGroups模型用于映射数据库表ims_users_founder_own_create_groups
class UsersFounderOwnCreateGroups(Base):
    __tablename__ = "ims_users_founder_own_create_groups"

    acid = Column(Integer, primary_key=True)  # 将id改为acid
    founder_uid = Column(Integer, nullable=False)
    create_group_id = Column(Integer, nullable=False)

    class Config:
         from_attributes = True

# UsersFounderOwnUniGroups模型用于映射数据库表ims_users_founder_own_uni_groups
class UsersFounderOwnUniGroups(Base):
    __tablename__ = "ims_users_founder_own_uni_groups"

    acid = Column(Integer, primary_key=True)  # 将id改为acid
    founder_uid = Column(Integer, nullable=False)
    uni_group_id = Column(Integer, nullable=False)

    class Config:
         from_attributes = True

# UsersFounderOwnUsers模型用于映射数据库表ims_users_founder_own_users
class UsersFounderOwnUsers(Base):
    __tablename__ = "ims_users_founder_own_users"

    acid = Column(Integer, primary_key=True)  # 将id改为acid
    uid = Column(Integer, nullable=False)
    founder_uid = Column(Integer, nullable=False)

    class Config:
         from_attributes = True

# UsersFounderOwnUsersGroups模型用于映射数据库表ims_users_founder_own_users_groups
class UsersFounderOwnUsersGroups(Base):
    __tablename__ = "ims_users_founder_own_users_groups"

    acid = Column(Integer, primary_key=True)  # 将id改为acid
    founder_uid = Column(Integer, nullable=False)
    users_group_id = Column(Integer, nullable=False)

    class Config:
         from_attributes = True


# UsersGroup模型用于映射数据库表ims_users_group
class UsersGroup(Base):
    __tablename__ = "ims_users_group"

    acid = Column(INTEGER(unsigned=True), primary_key=True)  # 将id改为acid
    owner_uid = Column(Integer, nullable=False)
    name = Column(String(50), nullable=False)
    package = Column(String(5000), nullable=False)
    maxaccount = Column(INTEGER(unsigned=True), nullable=False)
    timelimit = Column(INTEGER(unsigned=True), nullable=False)
    maxwxapp = Column(INTEGER(unsigned=True), nullable=False)
    maxwebapp = Column(Integer, nullable=False)
    maxphoneapp = Column(Integer, nullable=False)
    maxxzapp = Column(Integer, nullable=False)
    maxaliapp = Column(Integer, nullable=False)
    maxbaiduapp = Column(Integer, nullable=False)
    maxtoutiaoapp = Column(Integer, nullable=False)

    class Config:
         from_attributes = True

# UsersInvitation模型用于映射数据库表ims_users_invitation
class UsersInvitation(Base):
    __tablename__ = "ims_users_invitation"

    acid = Column(INTEGER(unsigned=True), primary_key=True)  # 将id改为acid
    code = Column(String(64), nullable=False)
    fromuid = Column(INTEGER(unsigned=True), nullable=False)
    inviteuid = Column(INTEGER(unsigned=True), nullable=False)
    createtime = Column(INTEGER(unsigned=True), nullable=False)

    class Config:
         from_attributes = True

# UsersLastUse模型用于映射数据库表ims_users_lastuse
class UsersLastUse(Base):
    __tablename__ = "ims_users_lastuse"

    acid = Column(Integer, primary_key=True)  # 将id改为acid
    uid = Column(Integer, nullable=False)
    uniacid = Column(Integer, nullable=False)
    modulename = Column(String(100), nullable=False)
    type = Column(String(100), nullable=False)

    class Config:
         from_attributes = True

# UsersLoginLogs模型用于映射数据库表ims_users_login_logs
class UsersLoginLogs(Base):
    __tablename__ = "ims_users_login_logs"

    acid = Column(INTEGER(unsigned=True), primary_key=True)  # 将id改为acid
    uid = Column(INTEGER(unsigned=True), nullable=False)
    ip = Column(String(15), nullable=False)
    city = Column(String(256), nullable=False)
    login_at = Column(INTEGER(unsigned=True), nullable=False)

    class Config:
         from_attributes = True


# UsersOperateHistory模型用于映射数据库表ims_users_operate_history
class UsersOperateHistory(Base):
    __tablename__ = "ims_users_operate_history"

    acid = Column(INTEGER(unsigned=True), primary_key=True)  # 将id改为acid
    type = Column(TINYINT, nullable=False)
    uid = Column(INTEGER(unsigned=True), nullable=False)
    uniacid = Column(INTEGER(unsigned=True), nullable=False)
    module_name = Column(String(100), nullable=False)
    createtime = Column(Integer, nullable=False)

    class Config:
         from_attributes = True

# UsersOperateStar模型用于映射数据库表ims_users_operate_star
class UsersOperateStar(Base):
    __tablename__ = "ims_users_operate_star"
    acid = Column(INTEGER(unsigned=True), primary_key=True)  # 将id改为acid
    type = Column(TINYINT, nullable=False)
    uid = Column(INTEGER(unsigned=True), nullable=False)
    uniacid = Column(INTEGER(unsigned=True), nullable=False)
    module_name = Column(String(100), nullable=False)
    rank = Column(Integer, nullable=False)
    createtime = Column(Integer, nullable=False)

    class Config:
         from_attributes = True

# UsersPermission模型用于映射数据库表ims_users_permission
class UsersPermission(Base):
    __tablename__ = "ims_users_permission"

    acid = Column(INTEGER(unsigned=True), primary_key=True)  # 将id改为acid
    uniacid = Column(INTEGER(unsigned=True), nullable=False)
    uid = Column(INTEGER(unsigned=True), nullable=False)
    type = Column(String(100), nullable=False)
    permission = Column(String(10000), nullable=False)
    url = Column(String(255), nullable=False)
    modules = Column(Text, nullable=False)
    templates = Column(Text, nullable=False)

    class Config:
         from_attributes = True


# UsersProfile模型用于映射数据库表ims_users_profile
class UsersProfile(Base):
    __tablename__ = "ims_users_profile"

    acid = Column(INTEGER(unsigned=True), primary_key=True)  # 将id改为acid
    uid = Column(INTEGER(unsigned=True), nullable=False)
    createtime = Column(INTEGER(unsigned=True), nullable=False)
    edittime = Column(Integer, nullable=False)
    realname = Column(String(10), nullable=False)
    nickname = Column(String(20), nullable=False)
    avatar = Column(String(255), nullable=False)
    qq = Column(String(15), nullable=False)
    mobile = Column(String(11), nullable=False)
    fakeid = Column(String(30), nullable=False)
    vip = Column(TINYINT, nullable=False)
    gender = Column(TINYINT, nullable=False)
    birthyear = Column(SmallInteger, nullable=False)
    birthmonth = Column(TINYINT, nullable=False)
    birthday = Column(TINYINT, nullable=False)
    constellation = Column(String(10), nullable=False)
    zodiac = Column(String(5), nullable=False)
    telephone = Column(String(15), nullable=False)
    idcard = Column(String(30), nullable=False)
    studentid = Column(String(50), nullable=False)
    grade = Column(String(10), nullable=False)
    address = Column(String(255), nullable=False)
    zipcode = Column(String(10), nullable=False)
    nationality = Column(String(30), nullable=False)
    resideprovince = Column(String(30), nullable=False)
    residecity = Column(String(30), nullable=False)
    residedist = Column(String(30), nullable=False)
    graduateschool = Column(String(50), nullable=False)
    company = Column(String(50), nullable=False)
    education = Column(String(10), nullable=False)
    occupation = Column(String(30), nullable=False)
    position = Column(String(30), nullable=False)
    revenue = Column(String(10), nullable=False)
    affectivestatus = Column(String(30), nullable=False)
    lookingfor = Column(String(255), nullable=False)
    bloodtype = Column(String(5), nullable=False)
    height = Column(String(5), nullable=False)
    weight = Column(String(5), nullable=False)
    alipay = Column(String(30), nullable=False)
    msn = Column(String(30), nullable=False)
    email = Column(String(50), nullable=False)
    taobao = Column(String(30), nullable=False)
    site = Column(String(30), nullable=False)
    bio = Column(Text, nullable=False)
    interest = Column(Text, nullable=False)
    workerid = Column(String(64), nullable=False)
    is_send_mobile_status = Column(TINYINT, nullable=False)
    send_expire_status = Column(TINYINT, nullable=False)

    class Config:
         from_attributes = True


